package com.ypx;

public class Student implements Comparable<Student> {
    // 定义学生的属性
    private String name;
    private int age;


    // 带参构造方法
    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }


    // 获取姓名
    public String getName() {
        return name;
    }

    // 设置姓名
    public void setName(String name) {
        this.name = name;
    }

    // 获取年龄
    public int getAge() {
        return age;
    }

    // 设置年龄
    public void setAge(int age) {
        this.age = age;
    }


    @Override
    public int compareTo(Student o) {
        return this.age - o.age;
    }
}
